import request from '@/utils/request'
import { praseStrEmpty } from "@/utils/ruoyi";

// 查询参数列表
export function listTermSchedule(query) {
  return request({
    url: '/workJobApi/termSchedule/listTermSchedule',
    method: 'get',
    params: query
  })
}

// 查询长期工班次列表
export function listTermTimeShift() {
  const query={};
  return request({
    url: '/workJobApi/termSchedule/listTermTimeShift',
    method: 'get',
    params: query
  })
}
// 查询考勤组下需要排班的人员列表
export function listUserSchedule(query) {

  return request({
    url: '/workJobApi/termSchedule/listUserSchedule',
    method: 'get',
    params: query
  })
}



// 查询周期班次列表
export function listCycleSchedule() {
  const query={};
  return request({
    url: '/workJobApi/termSchedule/listCycleSchedule',
    method: 'get',
    params: query
  })
}

// 查询用户角色列表列表 后面是考勤组
export function listRole() {

  return request({
    url: '/workJobApi/termSchedule/listRole',
    method: 'get'

  })
}

// 查询详细
export function getTermSchedule(id) {
  return request({
    url: '/workJobApi/termSchedule/' + praseStrEmpty(id),
    method: 'get'
  })
}
export function  userScheduleExport(data){
  return request({
    url: '/workJobApi/termSchedule/userScheduleExport',
    method: 'get',
    params: data
  })
}



// 新增长期工班次
export function add(data) {
  return request({
    url: '/workJobApi/termSchedule/add',
    method: 'post',
    data: data
  })
}


// 新增周期排班
export function addCycleSchedule(data) {
  return request({
    url: '/workJobApi/termSchedule/addCycleSchedule',
    method: 'post',
    data: data
  })
}

// 修改长期工班次
export function update(data) {
  return request({
    url: '/workJobApi/termSchedule/',
    method: 'put',
    data: data
  })
}
// 修改状态
export function editStatus(data) {
  return request({
    url: '/workJobApi/termSchedule/editStatus',
    method: 'post',
    data: data
  })
}


// 删除长期工班次
export function delTermSchedule(id) {
  return request({
    url: '/workJobApi/termSchedule/' + id,
    method: 'delete'
  })

}
export function importSchedule(url, file) {
  let data = new FormData();

  file.forEach(everyFile => {
    data.append("file", everyFile.raw);
  });
  return request({
    url: url,
    method: "post",
    data: data
  });
}


